package actions;

import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import metier.IMetier;
import donnees.*;

public class ActionVoirPageInfosClient extends UnicastRemoteObject implements IAction{
	private static final long serialVersionUID = -3148909974227460835L;

	public ActionVoirPageInfosClient() throws RemoteException {
		super();
	}

	@Override
	public String execute(HttpServletRequest req) throws Exception{
		HttpSession theSession=req.getSession(true);
		IMetier metier=(IMetier)Naming.lookup("rmi://localhost:2000/ServeurMetier");
		ArrayList<Commande> lesCmdes=metier.getCommandesDuClient(((Client)theSession.getAttribute("leClient")).getId());
		theSession.setAttribute("lesAnciennesCmdes",lesCmdes);
		return "pageInfosClient.jsp";
	}

}
